#include <bits/stdc++.h>
using namespace std;

int main() {
    double a, b;
    cin >> a >> b;
    int n = a / b;
    cout << a - n * b;
    return 0;
}